package cn.hjh.dao;

import cn.hjh.pojo.Dept;
import cn.hjh.pojo.Emp;
import cn.hjh.pojo.EmpCondition;
import org.hibernate.Query;

import javax.persistence.Table;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;


public class EmpDao extends BaseDao {
	
	public void save(Emp emp){
		this.currentSession().save(emp);
	}

	public List<Emp> findByDept(Dept dept){
		String hql = "from Emp as emp where emp.dept = ?";
		return this.currentSession().createQuery(hql).setParameter(0,dept).list();
	}

	public List<Emp> findAll(){
		return this.currentSession().createQuery("from Emp").list();
	}

	public Emp load(Serializable empNo){
		return (Emp) this.currentSession().load(Dept.class,empNo);
	}
}
